<%--<%@ include file="head.jsp"%>--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>'
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="/static/houtai/css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/static/houtai/js/jquery-3.0.0.min.js"></script>
    <script type="text/javascript" src="/static/houtai/commons/common.js"></script>
    <script language="javascript">
        $(function(){
            //导航切换
            $(".imglist li").click(function(){
                $(".imglist li.selected").removeClass("selected")
                $(this).addClass("selected");
            })
        })
    </script>
    <script type="text/javascript">
        $(document).ready(function(){
            $(".click").click(function(){
                $(".tip").fadeIn(200);
            });

            $(".tiptop a").click(function(){
                $(".tip").fadeOut(200);
            });

            $(".sure").click(function(){
                $(".tip").fadeOut(100);
            });

            $(".cancel").click(function(){
                $(".tip").fadeOut(100);
            });

        });
    </script>
    <style type="text/css">
        #updateBtn{
            width: 80px;
            height: 37px;
           padding-left: 0px;
        }
        #chakanBtn {
            width: 114px;
            height: 37px;
            padding-left: 7px;
        }
        .imgtable tr{
            height: 45px;
        }
    </style>
</head>
<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">首页</a></li>
        <li><a href="#">用户操作</a></li>
    </ul>
</div>
<div>
    <table class="imgtable">
        <thead>
        <tr>
            <th>用户编号</th>
            <th>用户名</th>
            <th>工作</th>
            <th>年龄</th>
            <th>手机号</th>
            <th>微信号</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
<c:forEach items="${page.list}" var="sysUser">
        <tr>
            <td>${sysUser.id}</td>
            <td>${sysUser.name}</td>
            <td>${sysUser.job}</td>
            <td>${sysUser.age}</td>
            <td>${sysUser.mobileNumber} </td>
            <td>${sysUser.weixinNumber} </td>
            <td><a href="/sysUser/toUpdateUser?id=${sysUser.id}" class="btn btn-primary btn-lg" id="updateBtn">修改</a>
                <a href="/sysUser/delSysUser?sysUserId=${sysUser.id}" class="btn btn-primary btn-lg" id="updateBtn">删除</a>
                <button class="btn btn-primary btn-lg" id="chakanBtn" data-toggle="modal" data-target="#myModal" data="${sysUser.id}" onclick="chakan(this)" >
                    查看用户奖章数
                </button>
            </td>
        </tr>
    </c:forEach>
        </tbody>
    </table>
    <div class="pagin">
        <div class="message"></div>
        <ul class="paginList">
        </ul>
    </div>
</div>
<div style="text-align:center">
    <ul class="pagination pagination-lg">
        <li> <%--上一页 hasPreviousPage布尔值是否有上一页，prePage上一页页面--%>
            <c:if test="${page.hasPreviousPage}">
                <a href="${ctx}/sysUser/find/?pageNum=${page.prePage}&pageSize=${page.pageSize}">«</a>
            </c:if></li>
        <%--navigatepageNums 集合所有页码  --%>
        <c:forEach items="${page.navigatepageNums}" var="nav">
            <c:if test="${nav == page.pageNum}">
                <li style="font-weight: bold;"><a href="javascript:;">${nav}</a></li>
            </c:if>
            <c:if test="${nav != page.pageNum}">
                <li><a href="${ctx}/sysUser/find/?pageNum=${nav}&pageSize=${page.pageSize}">${nav}</a></li>
            </c:if>
        </c:forEach>
        <%--hasNextPage 布尔值判断是否有下一页 nextPage下一页的页码--%>
        <c:if test="${page.hasNextPage}">
            <li><a href="${ctx}/sysUser/find/?pageNum=${page.nextPage}&pageSize=${page.pageSize}">»</a></li>
        </c:if>
    </ul>
</div>





<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    用户：<input name="id" id="userid">
                </h4>
            </div>
            <div class="modal-body">
                 用户的奖章数：<input name="medalCount" id="MedalCount">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" onclick="submit1()" data-dismiss="modal">
                    提交更改
                </button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
</body>
<script language="javascript">
    $(function(){
        //导航切换
        $(".imglist li").click(function(){
            $(".imglist li.selected").removeClass("selected")
            $(this).addClass("selected");
        })
    })
</script>
<script type="text/javascript">
    $(document).ready(function(){
        $(".click").click(function(){
            $(".tip").fadeIn(200);
        });

        $(".tiptop a").click(function(){
            $(".tip").fadeOut(200);
        });

        $(".sure").click(function(){
            $(".tip").fadeOut(100);
        });

        $(".cancel").click(function(){
            $(".tip").fadeOut(100);
        });

    });



function chakan (obj) {
    var ids = $(obj).attr("data");
    $("#userid").val(ids);
    $.ajax({
        type: 'GET',
        url: '/medalRecord/houtaifindByUserOfMedalRecordCount?ids='+ids,
        contentTypJSONe: "application/json",
        success: function(req){
            console.log(req);
            $("#MedalCount").val(req);
        },
        error:function(){
            layer.msg("请求失败");
        }

    });

}

function submit1 () {
    var ids= $("#userid").val();
    var MedalCount=$("#MedalCount").val();
//    alert(ids+" "+MedalCount);
    var datas={
        id:ids,
        medalCount:MedalCount
    };

    $.ajax({
        type: 'POST',
        url: '/medalRecord/saveByUserOfMedalCount',
        contentType: "application/json",
        data:JSON.stringify(datas),
        success: function(req){
        },
        error:function(){
            layer.msg("请求失败");
        }

    });

}


</script>
<%@ include file="foot.jsp"%>

